Skip to content

Conversation

Artur-
Copy link
Member

@Artur- Artur- commented Sep 22, 2025

Implements scrollToColumn method to enable horizontal scrolling in Grid, particularly useful when columnRendering is set to lazy. This addresses the issue where cells return null when columns are out of view.

New features:

  • scrollToColumn(GridColumnElement) - scrolls to specific column
  • scrollToColumn(int columnIndex) - scrolls to column by index
  • isColumnInView(GridColumnElement) - checks if column is visible
  • Automatic column scrolling in getCell() method

This enhancement allows reliable testing of grids with many columns and lazy column rendering, fixing the issue where it was impossible to distinguish between genuinely null cells and cells not rendered due to being out of view.

Fixes #8046

Implements scrollToColumn method to enable horizontal scrolling in Grid,
particularly useful when columnRendering is set to lazy. This addresses
the issue where cells return null when columns are out of view.

New features:
- scrollToColumn(GridColumnElement) - scrolls to specific column
- scrollToColumn(int columnIndex) - scrolls to column by index
- isColumnInView(GridColumnElement) - checks if column is visible
- Automatic column scrolling in getCell() method

This enhancement allows reliable testing of grids with many columns
and lazy column rendering, fixing the issue where it was impossible
to distinguish between genuinely null cells and cells not rendered
due to being out of view.

Fixes #8046

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Artur- and others added 11 commits September 22, 2025 13:07
Fixed compilation error by using ColumnRendering.LAZY instead of
the non-existent Grid.ColumnRenderingMode.LAZY
The scrollToColumn method was using a non-existent grid.$.table.scrollToColumn(index) API.
Fixed to properly manipulate table.scrollLeft to scroll columns into view based on their
position relative to the table viewport.

This fix ensures horizontal scrolling works correctly with lazy column rendering,
allowing cells to be accessed reliably even when columns are initially out of view.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

column.__generatedTbId = grid.__generatedTbId++;
}
});
return grid._getColumns().length;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return grid._getColumns().length;

This new line seems to serve no purpose.

* Gets the grid cell for the given row and column.
* <p>
* Automatically scrolls the given row into view
* Automatically scrolls the given row and column into view
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This JavaDoc update should also be applied to the JavaDoc of the other overload.

* the column to check
* @return {@code true} if the column is visible, {@code false} otherwise
*/
public boolean isColumnInView(GridColumnElement column) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep this private for now, similar to how it is with isRowInView.

@@ -0,0 +1,72 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests seem to be testing whether the GridElement API is working rather than the Grid itself. I think we can remove the page and the test class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GridElement should provide a method to scroll to a specific column

2 participants